/*
 *  Copyright (c) 2010-2023
 */
package net.siufung.market.base.uuid.controller.assembler;

import com.google.common.collect.Lists;
import java.util.List;
import java.util.Objects;
import org.springframework.util.CollectionUtils;
import net.siufung.core.utils.CopyUtil;
import net.siufung.market.base.uuid.mapper.entity.SysUuidRules;
import net.siufung.market.base.uuid.controller.model.SysUuidRulesModel;

/**
 *
 * 流水号配置表 持久层展示层组装器
 *
 * @author 陈建峰
 * @since 2023-10-09 22:16:17
 * @version 1.0.0
*/
public class SysUuidRulesAssembler {

    /**
     * SysUuidRules 转换成 SysUuidRulesModel.Vo
     * @param sysUuidRules 数据实体
     * @return SysUuidRulesModel.Vo视图
     */
    public static SysUuidRulesModel.Vo from(SysUuidRules sysUuidRules){
        if(!Objects.isNull(sysUuidRules)){
            SysUuidRulesModel.Vo sysUuidRulesVo = new SysUuidRulesModel.Vo();
            CopyUtil.copyProperties(sysUuidRules, sysUuidRulesVo);
            return sysUuidRulesVo;
        }
        return null;
    }

    /**
     * SysUuidRulesList 转换成 sysUuidRulesModelVoList
     * @param sysUuidRulesList 数据库实体集合
     * @return List<SysUuidRulesModel.Vo}> 视图集合
     */
    public static List<SysUuidRulesModel.Vo> fromList(List<SysUuidRules> sysUuidRulesList){
        List<SysUuidRulesModel.Vo> sysUuidRulesVoList = Lists.newArrayList();
        if(!CollectionUtils.isEmpty(sysUuidRulesList)){
            SysUuidRulesModel.Vo sysUuidRulesVo;
            for (SysUuidRules sysUuidRules: sysUuidRulesList) {
                sysUuidRulesVo = new SysUuidRulesModel.Vo();
                CopyUtil.copyProperties(sysUuidRules, sysUuidRulesVo);
                sysUuidRulesVoList.add(sysUuidRulesVo);
            }
        }
        return sysUuidRulesVoList;
    }
}